import {
  exportUrl,
  getBarcodePrintTempList,
  getTempList,
  getYesOrNot,
} from "@/api/print/mesProdBarcodePrint";
import { listByConfigRole } from "@/api/common";
// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t("common.export"),
    type: "primary",
    icon: "el-icon-download",
    handleName: "export", //点击时返回的标识
    url: exportUrl,
    //auth: "auth:operlog:export", //权限字段
  },
];
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t("common.view"),
    type: "primary",
    class: "row-btn-primary",
    handleName: "show", //点击时返回的标识
  },
];
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    orderCode: {
      type: "input",
      label: $i18n.t("mesUniqueCode.prodWorkOrderCode"),
    },
    barcode: {
      type: "input",
      label: $i18n.t("mesUniqueCode.uniqueCode"),
    },

    prodCode: {
      type: "input",
      label: $i18n.t("mesUniqueCode.modelCode"),
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesUniqueCode.modelName"),
    },
    planBeginDate: {
      type: "daterange",
      label: $i18n.t("mesUniqueCode.planBeginDate"),
      attrs: {
        valueFormat: "yyyy-MM-dd",
        searchArrKey: ["planBeginDateMin", "planBeginDateMax"],
      },
    },
    barcodePrintTemp: {
      type: "select",
      label: $i18n.t("mesUniqueCode.barcodePrintTemp"),
      prop: {
        value: "tempName",
        text: "tempName",
      },
      options: async (data) => {
        const list = await listByConfigRole({
          businessTypeCode: "PRINT_MES_PC_UNIQUE_CODE",
        });
        return list.data.result;
      },
    },
    isPrint: {
      type: "select",
      label: $i18n.t("mesUniqueCode.isPrint"),
      prop: {
        value: "value",
        text: "description",
      },
      options: async (data) => {
        const list = await getYesOrNot();
        return list.data.result;
      },
    },
    isSubmitted: {
      type: "select",
      label: $i18n.t("mesUniqueCode.isSubmitted"),
      prop: {
        value: "value",
        text: "description",
      },
      options: async (data) => {
        const list = await getYesOrNot();
        return list.data.result;
      },
    },
  },
};
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: true,
  isShowSubmitBtn: false,
  formDesc: {
    planCode: {
      type: "input",
      label: $i18n.t("mesUniqueCode.planCode"),
      layout: 12,
      required: false,
    },
    barcode: {
      type: "input",
      label: $i18n.t("mesUniqueCode.uniqueCode"),
      layout: 12,
      required: false,
    },
    prodCode: {
      type: "input",
      label: $i18n.t("mesUniqueCode.modelCode"),
      layout: 12,
      required: false,
    },
    prodName: {
      type: "input",
      label: $i18n.t("mesUniqueCode.modelName"),
      layout: 12,
      required: false,
    },
    seriesCode: {
      type: "input",
      label: $i18n.t("mesUniqueCode.seriesCode"),
      layout: 12,
      required: false,
    },
    seriesName: {
      type: "input",
      label: $i18n.t("mesUniqueCode.seriesName"),
      layout: 12,
      required: false,
    },
    // count: {
    //   type: "number",
    //   label: $i18n.t("mesUniqueCode.volume"),
    //   layout: 12,
    //   required: false
    // },
    planBeginDate: {
      type: "date",
      label: $i18n.t("mesUniqueCode.planBeginDate"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd",
      },
    },
    planEndDate: {
      type: "date",
      label: $i18n.t("mesUniqueCode.planEndDate"),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: "yyyy-MM-dd",
      },
    },
    barcodePrintTemp: {
      type: "input",
      label: $i18n.t("mesUniqueCode.barcodePrintTemp"),
      layout: 12,
      required: false,
    },
    lineCode: {
      type: "input",
      label: $i18n.t("common.lineCode"),
      layout: 12,
      required: false,
    },
    lineName: {
      type: "input",
      label: $i18n.t("common.lineName"),
      layout: 12,
      required: false,
    },
    isPrint: {
      type: "select",
      label: $i18n.t("mesUniqueCode.isPrint"),
      layout: 12,
      required: false,
      prop: {
        value: "value",
        text: "description",
      },
      options: async (data) => {
        const list = await getYesOrNot();
        return list.data.result;
      },
    },
    isSubmitted: {
      type: "select",
      label: $i18n.t("mesUniqueCode.isSubmitted"),
      layout: 12,
      required: false,
      prop: {
        value: "value",
        text: "description",
      },
      options: async (data) => {
        const list = await getYesOrNot();
        return list.data.result;
      },
    },
    remark: {
      type: "textarea",
      label: $i18n.t("common.remark"),
      layout: 12,
      required: false,
    },
  },
};
